#include <bits/stdc++.h>
using namespace std;

void print_square(int n) {
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j <= n; ++j) {
      int no = i * n + j;
      printf("%02d", no);
    }
    putchar('\n');
  }
}

void print_triangle(int n) {
  int cnt = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (i + j <= n)
        printf("  ");
      else {
        printf("%02d", cnt);
        cnt++;
      }
    }
    putchar('\n');
  }
}

int main() {
  int n;
  cin >> n;
  print_square(n);
  putchar('\n');
  print_triangle(n);
}
